<span id="${uuid}"></span>
<div class="box_tc_s">
    <c:if test="${hasChildren}">
        <h3>基本信息</h3>
    </c:if>
    <form data-id="baseForm" method="post">
        <input type="hidden" value="${pBom.id}" data-id="id" name="tPBom.id"/>
        <table border="1" class="hydra-table" cellpadding="0" cellspacing="0">
            <tr class="hydra-tr-bg">
                <td class="hydra-left">结构编码：</td>
                <td class="hydra-right">
                    系统将根据装配结果自动生成，在保存以后提示
                </td>
            </tr>
            <tr>
                <td class="hydra-left">结构名称：</td>
                <td class="hydra-right">
                    <input type="text" data-id="eName"
                           name="eName" class="easyui-validatebox hydra-input-width"
                           data-options="required:true,validType:['length[0,20]']"
                           placeholder="结构名称.." value="${pBom.pName}"/>
                </td>
            </tr>
            <c:if test="${!hasChildren}">
                <tr>
                    <td class="hydra-left">数量：</td>
                    <td class="hydra-right">
                        <input type="text" data-id="number"
                               name="number" class="easyui-validatebox hydra-input-width"
                               data-options="min:1,max:500,required:true"
                               placeholder="数量.." value="1"/>
                    </td>
                </tr>
            </c:if>
            <tr>
                <td class="hydra-left">图片：</td>
                <td class="hydra-right">
                    <input type="text" data-id="uploadCover" name="cover" value="/default/temp2.png"/>
                </td>
            </tr>
            <tr>
                <td class="hydra-left">功能：</td>
                <td class="hydra-right">
                    <textarea data-id="description"
                              autocomplete="off" name="description"
                              class="easyui-validatebox hydra-input-width hydra-textarea"
                              data-options="validType:['normalChar','length[0,400]']"
                              placeholder="备注.."></textarea>
                </td>
            </tr>
            <tr class="hydra-tr-bg">
                <td class="hydra-left">备注:</td>
                <td class="hydra-right"><textarea data-id="remark"
                                                  autocomplete="off" name="remark"
                                                  class="easyui-validatebox hydra-input-width hydra-textarea"
                                                  data-options="validType:['normalChar','length[0,400]']"
                                                  placeholder="备注.."></textarea></td>
            </tr>
        </table>
        <c:if test="${hasChildren}">
            <input type="hidden" value="0" name="number" data-id="number"/>
        </c:if>
    </form>
    <c:if test="${hasChildren}">
        <h3 class="mt10">装配信息</h3>

        <div class="build">
            <div>
                装配工件需要的零部件，根据以下零部件信息可装配工件数<span class="num-box" data-id="num"></span>件
            </div>
            <c:forEach items="${pBom.children}" var="item">
                <form data-id="itemForm">
                    <input type="hidden" name="id" value="${item.id}"/>
                    <ul class="build-item" data-item="${item.id}" data-need="${item.number}">
                        <li class="non-mt10">
                            <span class="item-title">pBom名称/编码：</span>${item.pName}/${item.code}
                        </li>
                        <li>
                            <span class="item-title">组装单个工件需要的该零部件数量：</span>${item.number}件
                        </li>
                        <li>
                            <span class="item-title">零部件选择方式：</span>
                        </li>
                        <li>
                            <label title="选择自动装配，则系统自动从所有匹配的零部件中选择指定数量的零部件作为装配工件使用">
                                <input data-id="choose-radio" type="radio" name="type_${item.id}" checked
                                       value="random"/>自动选择零部件装配
                            </label>
                            <label title="选择手动装配，则手动选择符合要求的零部件作为装配工件使用" class="ml20">
                                <input data-id="choose-radio" type="radio" name="type_${item.id}" value="choose"/>手动选择零部件装配
                            </label>

                            <div class="mt10 choose-one" data-id="random">
                                使用
                                <input type="text" value="${item.nonBuild}" name="useNumber" data-id="buildNum"
                                       data-options="min:1,max:${item.nonBuild}"
                                       class="hydra-input-width" style="width: 50px"/>/
                                <span data-id="max">${item.nonBuild}</span>
                                件用于组装
                                <a data-id="view" iconCls="fa fa-eye fa-lg" plain="true"
                                   href="javascript:void(0)">查看所有匹配的工件</a>
                            </div>
                            <div class="mt10 choose-one" data-id="choose" style="display: none">
                                <a href="javascript:void(0)" data-id="addTool" iconCls="fa fa-plus">添加工件</a>

                                <div class="selected-tool">
                                    <div class="tool-box" data-id="tool-box"></div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </form>
            </c:forEach>
        </div>
    </c:if>
</div>
<script language="javascript" type="text/javascript">
    seajs.use("apps/ebom/main", function (page) {
        page.build("${pageContext.request.contextPath}", "${uuid}", {
            totalSuit: "${pBom.suitAll}",
            pBomId:"${pBom.id}"
        });
    });
</script>